package Es

import (
	"4-26zk/comment/nacos"
	"fmt"
	"github.com/elastic/go-elasticsearch/v7"
)

var Es *elasticsearch.Client

func EsInit() {
	nac := nacos.Config.Es
	cfg := elasticsearch.Config{
		Addresses: []string{
			"http://" + nac.Host,
		},
		// ...
	}
	_, err := elasticsearch.NewClient(cfg)
	if err != nil {
		fmt.Println("es连接失败")
	} else {
		fmt.Println("es连接成功")
	}
}
